
#include "GameState/Options/Options.h"
#include "GameState/Options/OptionsMenu.h"
#include "Engine/Backbone.h"

namespace GameState {

namespace Options {

Options * Options::singleInstance = NULL; 
Options::Options() : 
	Reason("optionsGameState"),
	Visual("optionsGameState"),
	Sense("optionsGameState"),
	topMenu(Misc::Frame(0,0,640,480), 3) ,
	background("optionsBg", "screen/options", -10) {
	topMenu[0] = new PictureTargetOption(Misc::Frame(70, 25, 500, 250));
	topMenu[1] = new LevelOption(Misc::Frame(70, 300, 500, 50));
	//topMenu[2] = new SoundThemeOption(Misc::Frame(70, 370, 500, 50));
	topMenu.active(true).hidden(false);
	topMenu.focusAt(0);
}

Options::~Options() {
}

void Options::pulse(int delta) {
}

// Asks for generation of a graphical model to be displayed
Engine::Resource::GraphicList Options::display() {
	Engine::Resource::GraphicList gfxList;
	gfxList.push_back(&background);
	return gfxList;
}

void Options::keyDown(SDLKey sym, SDLMod mod, Uint16 unicode) {
	switch (sym) {
		case SDLK_RETURN:
			// enter in the selected entry
			topMenu.select();
// 			Engine::Synaptic::Sound::play("sounds/menuSelect.wav");
			break;
		case SDLK_UP:
			topMenu.focusPrevious();
// 			Engine::Synaptic::Sound::play("sounds/menuChange.wav");
			break;
		case SDLK_DOWN:
			topMenu.focusNext();
// 			Engine::Synaptic::Sound::play("sounds/menuChange.wav");
			break;
		case SDLK_ESCAPE:
			Engine::Backbone::changeContext("masterGameState");
			break;
		default:
			break;
	}
}


} // namespace GameState::Options

} // namespace GameState
